<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
    <script src="./utils/Query.js"></script>

</head>

<body>
    <button onclick="test()">查询</button>
    <div id="map">
    </div>
    <script>
        var docLayer = new Zondy.Map.Doc("", "zxd-plus-pla", {

        })
        var map = new ol.Map({
            target: "map",
            layers: [gaode, docLayer],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        let service = {
            name: "zxd-plus-pla",
            layerId: [2]
        }
        function test() {
            Query.queryByLayerId({
                service,
                callback: handleSuccess
            })
        }
        const style = new ol.style.Style({
            image: new ol.style.Circle({
                radius: 15,
                fill: new ol.style.Fill({
                    color: "#652e80"
                })
            })
        })
        var high_source = new ol.source.Vector({

        })
        var high_layer = new ol.layer.Vector({
            source: high_source,
            style
        })
        map.addLayer(high_layer);
        function handleSuccess(data) {
            /* 将查询到的要素高亮显示 */
            var format = new Zondy.Format.PolygonJSON();
            //将MapGIS要素JSON反序列化为ol.Feature类型数组
            var features = format.read(data);
            console.log(features)
            high_source.addFeatures(features);
        }
    </script>
</body>

</html>